using System;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text;
using System.Runtime;
using System.Runtime.InteropServices;

namespace Hack.Decompiling.PEA.DOS
{
  /// <summary>
  /// RelocationEntry
  /// </summary>
  public unsafe struct RelocationEntry // 4 Bytes
  {
    #region Statics
    public static RelocationEntry it()
    {
      return new RelocationEntry();
    }
    public static RelocationEntry of(UInt16 Offset, UInt16 Segment)
    {
      return new RelocationEntry(Offset, Segment);
    }
    #endregion
    #region Definition Fields
    public UInt16 Offset;
    public UInt16 Segment;
    #endregion
    #region Constructors
    public RelocationEntry(UInt16 Offset, UInt16 Segment)
    {
      this.Offset = Offset;
      this.Segment = Segment;
    }
    #endregion
    #region Methods
    public RelocationEntry Read(BinaryReader reader)
    {
      if (reader != null)
      {
        this.Offset = Utils.Read16(reader);
        this.Segment = Utils.Read16(reader);

      }
      return this;
    }
    public RelocationEntry Write(BinaryWriter writer)
    {
      if (writer != null)
      {
        Utils.Write16(writer, this.Offset);
        Utils.Write16(writer, this.Segment);
      }
      return this;
    }
    #endregion
  }
}
